<div class="groups view">
<h2><?php echo 'Група'; ?></h2>
	<dl><?php $i = 0; $class = ' class="altrow"';?>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php echo 'ID'; ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $group['Group']['id']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php echo 'Заглавие'; ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo htmlspecialchars($group['Group']['title']); ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php echo 'Родител'; ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php
				if(!empty($parentGroup)) {
					echo $this->Html->link($parentGroup['Group']["title"], array('admin' => true, 'plugin' => null, 'controller' => 'groups', 'action' => 'view', $parentGroup['Group']['id']));
				} else {
					echo 'няма стойност';
				}
			?>
			&nbsp;
		</dd>
	</dl>
</div>
<div class="actions">
	<h3><?php echo 'Действия:'; ?></h3>
	<ul>
		<?php
			/**
			 * Ako ne e ot zapazenite grupi, togava pokazvame dadenoto deistvie
			 */
			if (($group['Group']['id']!=1) && ($group['Group']['id']!=2)) {
				echo '<li>'.$this->Html->link('Редактиране', array('admin' => true, 'plugin' => null, 'controller' => 'groups', 'action' => 'edit', $group['Group']['id'])).'</li>';
				echo '<li>'.$this->Html->link('Изтриване', array('admin' => true, 'plugin' => null, 'controller' => 'groups', 'action' => 'delete', $group['Group']['id']), null, sprintf('Сигурни ли сте, че искате да изтриете # %s?', $group['Group']['id'])).'</li>';
			}
		?>
		<li><?php echo $this->Html->link('Списъкът групи', array('admin' => true, 'plugin' => null, 'controller' => 'groups', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link('Добави група', array('admin' => true, 'plugin' => null, 'controller' => 'groups', 'action'=>'add')); ?> </li>
	</ul>
</div>
<div class="related">
	<h3><?php echo 'Потребители от тази група';?></h3>
	<?php if (!empty($group['User'])) {?>
	<table cellpadding = "0" cellspacing = "0">
	<tr>
		<th><?php echo 'ID'; ?></th>
		<th><?php echo 'Потребителско име'; ?></th>
		<th class="actions"><?php echo 'Действия';?></th>
	</tr>
	<?php
		$i = 0;
		foreach ($group['User'] as $user) {
			$class = null;
			if ($i++ % 2 == 0) {
				$class = ' class="altrow"';
			}
		?>
		<tr<?php echo $class;?>>
			<td><?php echo $user['id'];?></td>
			<td><?php echo htmlspecialchars($user['username']);?></td>
			<td class="actions">
				<?php echo $this->Html->link('Преглед', array('admin' => true, 'plugin' => null, 'controller' => 'users', 'action' => 'view', $user['id'])); ?>
				<?php echo $this->Html->link('Редактиране', array('admin' => true, 'plugin' => null, 'controller' => 'users', 'action' => 'edit', $user['id'])); ?>
				<?php echo $this->Html->link('Изтриване', array('admin' => true, 'plugin' => null, 'controller' => 'users', 'action' => 'delete', $user['id']), null, sprintf('Сигурни ли сте, че искате да изтриете # %s?', $user['id'])); ?>
			</td>
		</tr>
	<?php } ?>
	</table>
<?php
 	} else {
		echo 'няма стойност';
	}
?>
</div>